package com.thunder.reader.util;

import java.text.SimpleDateFormat;
import java.util.Date;

import android.os.Environment;

public class Utility {
    
    // Not allowed to be instantiated
    private Utility() {}
    
    public static boolean sdcardWritable() {
        final String sdcardState = Environment.getExternalStorageState();
        return sdcardState.equals(Environment.MEDIA_MOUNTED);
    }
    
    public static boolean sdcardAvailable() {
        final String state = Environment.getExternalStorageState();
        return state.equals(Environment.MEDIA_MOUNTED) ||
                state.equals(Environment.MEDIA_MOUNTED_READ_ONLY) ||
                state.equals(Environment.MEDIA_CHECKING);
    }

    public static String dateToString(long date) {
        return new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(new Date(date));
    }
}
